/*
 * @Author: your name
 * @Date: 2021-06-05 10:28:55
 * @LastEditTime: 2021-06-05 10:50:03
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \HW5\src\q3.cpp
 */
#include "../inc/q3.hpp"

Student_::Student_(int _age)
{
    if (_age < 15 || _age > 60)
        throw myException();
    else
        age = _age;
}

Student_::~Student_()
{
}
void testQ3()
{
    cout << "input age 1" << endl;
    try
    {
        Student_ s1(1);
    }
    catch (const std::exception &e)
    {
        std::cerr << e.what() << '\n';
    }

    cout << "input age 61" << endl;
    try
    {
        Student_ s2(61);
    }
    catch (const std::exception &e)
    {
        std::cerr << e.what() << '\n';
    }

    cout << "input age 39" << endl;
    try
    {
        Student_ s3(39);
    }
    catch (const std::exception &e)
    {
        std::cerr << e.what() << '\n';
    }
}